home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group97a.txt / 000001_icon-group-sender _Fri Jan 3 06:46:00 1997.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Received: by cheltenham.cs.arizona.edu; Fri, 3 Jan 1997 17:23:10 MST
  2. From: eka@corp.cirrus.com (Eka Laiman)
  3. Message-Id: <9701031442.AA08170@ss492.corp.cirrus.com>
  4. Subject: Re: Help for an Icon Neophyte
  5. To: robinstu@ohsu.edu
  6. Date: Fri, 3 Jan 1997 06:46:00 -0800 (PST)
  7. Cc: icon-group@cs.arizona.edu
  8. In-Reply-To: <no.id> from "Stuart Robinson" at Jan 2, 97 11:02:16 am
  9. X-Mailer: ELM [version 2.4 PL24alpha3]
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=US-ASCII
  12. Content-Transfer-Encoding: 7bit
  13. Errors-To: icon-group-errors@cs.arizona.edu
  14. Status: RO
  15. Content-Length: 1651
  16.  
  17. > I have run into the following problems.  First, I was unsuccessful at
  18. > mapping lowercase letters on to uppercase letters.  I assume that I want
  19. > to use something like map(line, &ucase, &lcase), but where should I
  20. > insert it?  And should the csets &ucase and &lcase be bracketted by
  21. > single quotations marks?  Second, the program seems to hang up at the
  22. > end.  I have no idea why that's happening.
  23. > Eventually I would like to have the program do the log-log plot, but for
  24. > now I can use the resulting output for exportation.
  25. > Thanks in advance for any help you can provide.
  26.  
  27. May I suggest how I would approach the problem?
  28.  
  29. 1.  I would use a table to store the different words. (I do not have my
  30.     ICON book with me at present - I am out of town), it is done with
  31.     something like:
  32.         wordtbl := table(0)
  33.  
  34. 2.  Read the text line by line.
  35.  
  36.         while (inline := read()) do {
  37.         // process the line here
  38.         }
  39.  
  40.         // process the result here
  41.  
  42. 3.  For each line do the following:
  43.     3.1. Map all non alphanumeric characters into "blank" (white space).
  44.      This can be done by defining the set of non-alphanumeric characters
  45.      at the outset of the program. Again something like:
  46.         non_alnum := &cset --- &alnum
  47.      (I don't remember the exact keywords).
  48.     3.2. Map the upper case to the lower case.
  49.  
  50.     The mapping process would read like:
  51.      inline := map(inline, source, dest)
  52.  
  53. 4.  Now break "inline" into words and store the count of each word in the
  54.     "wordtbl".
  55.  
  56. 5.  When out of the "while read" loop, do something (again like this):
  57.  
  58.        every word := key(wordtbl) do {
  59.         write(word || "\t" || wordtbl[word])
  60.        }
  61.  
  62. -eka-
  63.